package com.lzq.mq.common.constants;

/**
 * Broker的常量定义
 */
public class BrokerConstants {

    public static final String SPLIT = "/";

    public static final String MQ_HOME = "EAGLE_MQ_HOME";     // 根目录环境变量
    public static final String BROKER_MODE = "BROKER_MODE";
    public static final String BROKER_FILE_DIR = "/broker";
    public static final String BASE_COMMITLOG_PATH = "/commit_log";   // 消息队列存储目录
    public static final String BASE_CONSUME_QUEUE_PATH = "/consume_queue";   // 消费队列存储目录
    public static final Integer COMMITLOG_DEFAULT_MMAP_SIZE = 1 * 1024 * 1024;  // commitlog的mmap大小
    public static final Integer COMSUMEQUEUE_DEFAULT_MMAP_SIZE = 1 * 1024 * 1024;
    public static final Integer REFRESH_MQ_TOPIC_TIME_STEP = 10;    // topic刷盘
    public static final Integer REFRESH_CONSUME_QUEUE_OFFSET_TIME_STEP = 10;
    public static final String MQ_TOPIC_JSON_PATH = "/config/mq-topic.json"; // topic的信息配置文件
    public static final String CONSUME_QUEUE_OFFSET_JSON_PATH = "/config/consume-queue-offset.json"; // 消费队列偏移量配置文件
    public static final Integer CONSUME_QUEUE_ELEMENT_BYTE_SIZE = 12;   // 消费队列元素大小

    public static final String BROKER_PROPERTY_FILE_PATH = "/config/broker.properties";

    /**
     * broker配置属性键值
     */
    public static final String BROKER_PROPERTY_KEY_NAMESERVER_IP = "nameserver.ip";
    public static final String BROKER_PROPERTY_KEY_NAMESERVER_PORT = "nameserver.port";
    public static final String BROKER_PROPERTY_KEY_NAMESERVER_USER = "nameserver.user";
    public static final String BROKER_PROPERTY_KEY_NAMESERVER_PASSWORD = "nameserver.password";
    public static final String BROKER_PROPERTY_KEY_BROKER_PORT = "broker.port";
    public static final String BROKER_PROPERTY_KEY_REBALANCE_STRATEGY = "rebalance.strategy";
    public static final String BROKER_PROPERTY_KEY_BROKER_CLUSTER_MODE = "broker.cluster.mode";
    public static final String BROKER_PROPERTY_KEY_BROKER_CLUSTER_ROLE = "broker.cluster.role";
    public static final String BROKER_PROPERTY_KEY_BROKER_CLUSTER_GROUP = "broker.cluster.group";


    /**
     * broker的属性键值
     * 用于获取serviceInstance中attr属性的键及可能的目标值
     * 用于拉取broker节点时的枚举
     * = PullBrokerIpRoleEnum
     */
    public static final String BROKER_ROLE_KEY = "role";

    /**
     * broker的分组属性key, 用于消息传递的attr附加属性获取
     */
    public static final String BROKER_GROUP_NAME_KEY = "group";

    /**
     * 重平衡策略
     */
    public static final String BROKER_REBALANCE_STRATEGY_RANDOM = "random";
    public static final String BROKER_REBALANCE_STRATEGY_RANGE = "range";
}
